<template>
  <div id="id">
    用户ID {{$route.params.id}}
    {{user}}
  </div>
</template>

<script>
export default {
  async asyncData({params, $axios}) {
    // 注意返回的就是响应数据
    const data = await $axios.$get(`/api/users/${params.id}`);
    if(data.ok){
      return {user: data.user}
    }
    error({statusCode: 400, message: '参数错误'})
  }
}
</script>

<style>

</style>